package cn.net.zj.scan.api;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import cn.net.zj.scan.base.Result;
import cn.net.zj.scan.bean.StateBean;
import cn.net.zj.scan.bean.TaskBean;
import cn.net.zj.scan.bean.TaskDetailBean;
import io.reactivex.Observable;
import io.reactivex.Single;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Url;

/**
 * Created by Administrator on 2018/3/19.
 */

public interface FYApi {

    /**
     * 登录
     */
    @GET("/jymf.api/user/login")
    Observable<StateBean> login(@Query("type") String type, @Query("companyId") String companyId, @Query("account") String account, @Query("pwd") String pwd);


    /**
     * 登录
     */
    @GET("/PurSal/GetUser?username")
    Observable<StateBean> login2(@Query("username") String username);
//    http://150.138.115.224:8011/PurSal/GetUser?username=采购员


    /**
     * @return 标签入库
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})//需要添加头
    @POST("/PurSal/PurData")
    Observable<StateBean> inHouse(@Body RequestBody info);


    /**
     * @return 获取客户名称
     */
    @GET("/PurSal/Customer")
    Observable<StateBean> getCustomerInfo(@Query("code") String companyId);


    /**
     * @return 返库数据
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})//需要添加头
    @POST("/PurSal/Saldata")
    Observable<StateBean> outLabelData(@Body RequestBody info);

    /**
     * 完全和基地址无关 ，会按照你穿过来的地址去发送网络请求
     *
     * @param url
     * @return
     */
    @GET
    Observable<StateBean> getNetDataWithUrl(@Url String url);


    /**
     * 获取任务列表
     *
     * @return
     */
    @POST("/PurSal/ICmobill")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Single<Result<ArrayList<TaskBean>>> getTaskList(@Body HashMap hashMap);


    /**
     * 查询任务明细
     */
    @GET("/PurSal/ICmoentry")
    Single<Result<ArrayList<TaskDetailBean>>> getTaskDetail(@Query("R_billno") String R_billno);


    /**
     * 任务单验证
     */
    @POST("/PurSal/IPuricmoData")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Single<Result<Map>> validateBill(@Body HashMap hashMap);
}
